/*
 *  Copyright 2004 by Texas Instruments Incorporated.
 *  All rights reserved. Property of Texas Instruments Incorporated.
 *  Restricted rights to use, duplicate or disclose this code are
 *  granted through contract.
 *  
 */
/* August 2004 */

#include <vport.h>
#include <vportdis.h>
#include <saa7105.h> 
#include <csl_edma.h>


#define EVMDM642_DIS_PARAMS_PORT_DEFAULT  {                           \
    FALSE,                      /*  enableDualChan;     */            \
    VPORT_POLARITY_ACTIVE_HIGH, /* vport control pin 1 polarity    */ \
    VPORT_POLARITY_ACTIVE_HIGH, /* vport control pin 2 polarity    */ \
    VPORT_POLARITY_ACTIVE_HIGH, /* vport control pin 3 polarity    */ \
    &SAA7105_Fxns,                                                    \
    INV,                                                              \
}    
          
#define EVMDM642_DIS_PARAMS_SAA7105_SDTV_DEFAULT(Mode, aFmt)  {   \
  SAA7105_AFMT_##aFmt##,                   \
  SAA7105_MODE_##Mode##,                  \
  SAA7105_IFMT_YCBCR422_INTERLACED,      \
  TRUE,                                  \
  FALSE,                                 \
  INV                                    \
}

#define EVMDM642_DIS_PARAMS_SAA7105_SDTV_EMBEDDED_DEFAULT(Mode, aFmt)  {   \
  SAA7105_AFMT_##aFmt##,                   \
  SAA7105_MODE_##Mode##,                  \
  SAA7105_IFMT_YCBCR422_INTERLACED,      \
  TRUE,                                  \
  TRUE,                                 \
  INV                                    \
}


#define DISPLAY_NTSC_LINE_SZ   720
#define DISPLAY_NTSC_NUM_LINES_PER_FLD 240

#define _EVMDM642_DIS_PARAMS_CHAN_NTSC_DEFAULT      {    \
    VPORT_MODE_BT656_8BIT, /* dmode:3       */    \
    VPORT_FLDOP_FRAME,     /* fldOp:3       */    \
    VPORT_SCALING_DISABLE, /* scale:1       */    \
    VPORT_RESMPL_DISABLE,  /* resmpl:1      */    \
    VPORTDIS_DEFVAL_ENABLE,/* defValEn:1    */    \
    VPORTDIS_BPK_10BIT_NORMAL, /*bpk10Bit:1 */    \
    VPORTDIS_VCTL1_HSYNC,  /* vctl1Config:2 */    \
    VPORTDIS_VCTL2_VSYNC,  /* vctl2Config:2 */    \
    VPORTDIS_VCTL3_FLD,    /* vctl3Config:1 */    \
    VPORTDIS_EXC_DISABLE,  /* extCtl:3      */    \
    858,                   /* frmHSize */         \
    525,                   /* frmVSize */         \
    0,                     /* imgHOffsetFld1 */   \
    0,                     /* imgVOffsetFld1 */   \
    DISPLAY_NTSC_LINE_SZ,               /* imgHSizeFld1   */   \
    DISPLAY_NTSC_NUM_LINES_PER_FLD,     /* imgVSizeFld1   */   \
    0,                     /* imgHOffsetFld2 */   \
    0,                     /* imgVOffsetFld2 */   \
    DISPLAY_NTSC_LINE_SZ,               /* imgHSizeFld2   */   \
    DISPLAY_NTSC_NUM_LINES_PER_FLD,     /* imgVSizeFld2   */   \
    720,                   /* hBlnkStart     */   \
    856,                   /* hBlnkStop      */   \
    720,                   /* vBlnkXStartFld1 */  \
    1,                     /* vBlnkYStartFld1 */  \
    720,                   /* vBlnkXStopFld1  */  \
    21,                    /* vBlnkYStopFld1  */  \
    360,                   /* vBlnkXStartFld2 */  \
    263,                   /* vBlnkYStartFld2 */  \
    360,                   /* vBlnkXStopFld2  */  \
    284,                   /* vBlnkYStopFld2  */  \
    720,                   /* xStartFld1 */    \
    1,                     /* yStartFld1 */    \
    360,                   /* xStartFld2 */    \
    263,                   /* yStartFld2 */    \
    736,                   /* hSyncStart */    \
    800,                   /* hSyncStop  */    \
    736,                   /* vSyncXStartFld1 */ \
    4,                     /* vSyncYStartFld1 */ \
    736,                   /* vSyncXStopFld1  */ \
    7,                     /* vSyncYStopFld1  */ \
    307,                   /* vSyncXStartFld2 */ \
    266,                   /* vSyncYStartFld2 */ \
    307,                   /* vSyncXStopFld2  */ \
    269,                   /* vSyncYStopFld2  */ \
    16,                    /* yClipLow        */ \
    235,                   /* yClipHigh       */ \
    16,                    /* cClipLow        */ \
    240,                   /* cClipHigh       */ \
    0x10,                                        \
    0x80,                                        \
    0x80,                                        \
                                                 \
                                                 \
    VPORTDIS_RGBX_DISABLE, /* RGB extract disable */          \
    0,                     /* incPix, for raw mode only */    \
    (DISPLAY_NTSC_LINE_SZ>>3),          /*thrld     */        \
    3,                     /*numFrmBufs*/                     \
    128,                     /*alignment */                   \
    VPORT_FLDS_MERGED,     /*mergeFlds */                     \
    NULL,                  /*segId     */                     \
    EDMA_OPT_PRI_HIGH,     /*edmaPri   */                     \
    8                      /* irqId    */                     \
}                                                           


#define DISPLAY_PAL_LINE_SZ    720
#define DISPLAY_PAL_NUM_LINES_PER_FLD 288

#define _EVMDM642_DIS_PARAMS_CHAN_PAL_DEFAULT      {    \
    VPORT_MODE_BT656_8BIT, /* dmode:3       */    \
    VPORT_FLDOP_FRAME,     /* fldOp:3       */    \
    VPORT_SCALING_DISABLE, /* scale:1       */    \
    VPORT_RESMPL_DISABLE,  /* resmpl:1      */    \
    VPORTDIS_DEFVAL_ENABLE,/* defValEn:1    */    \
    VPORTDIS_BPK_10BIT_NORMAL, /*bpk10Bit:1 */    \
    VPORTDIS_VCTL1_HSYNC,  /* vctl1Config:2 */    \
    VPORTDIS_VCTL2_VSYNC,  /* vctl2Config:2 */    \
    VPORTDIS_VCTL3_FLD,    /* vctl3Config:1 */    \
    VPORTDIS_EXC_DISABLE,  /* extCtl:3      */    \
    864,                  /* frmHSize */         \
    625,                  /* frmVSize */         \
    0,                    /* imgHOffsetFld1 */   \
    0,                    /* imgVOffsetFld1 */   \
    DISPLAY_PAL_LINE_SZ,              /* imgHSizeFld1   */   \
    DISPLAY_PAL_NUM_LINES_PER_FLD,            /* imgVSizeFld1   */   \
    0,                    /* imgHOffsetFld2 */   \
    0,                    /* imgVOffsetFld2 */   \
    DISPLAY_PAL_LINE_SZ,              /* imgHSizeFld2   */   \
    DISPLAY_PAL_NUM_LINES_PER_FLD,            /* imgVSizeFld2   */   \
    720,                  /* hBlnkStart     */   \
    862,                  /* hBlnkStop      */   \
    720,                  /* vBlnkXStartFld1 */  \
    624,                  /* vBlnkYStartFld1 */  \
    720,                  /* vBlnkXStopFld1  */  \
    23,                   /* vBlnkYStopFld1  */  \
    360,                  /* vBlnkXStartFld2 */  \
    311,                  /* vBlnkYStartFld2 */  \
    360,                  /* vBlnkXStopFld2  */  \
    336,                  /* vBlnkYStopFld2  */  \
    720,                  /* xStartFld1 */    \
    1,                    /* yStartFld1 */    \
    360,                  /* xStartFld2 */    \
    313,                  /* yStartFld2 */    \
    752,                  /* hSyncStart */    \
    782,                  /* hSyncStop  */    \
    752,                  /* vSyncXStartFld1 */ \
    1,                    /* vSyncYStartFld1 */ \
    752,                  /* vSyncXStopFld1  */ \
    3,                    /* vSyncYStopFld1  */ \
    320,                  /* vSyncXStartFld2 */ \
    313,                  /* vSyncYStartFld2 */ \
    320,                  /* vSyncXStopFld2  */ \
    316,                  /* vSyncYStopFld2  */ \
    16,                   /* yClipLow        */ \
    235,                  /* yClipHigh       */ \
    16,                   /* cClipLow        */ \
    240,                  /* cClipHigh       */ \
    0x10,                                       \
    0x80,                                       \
    0x80,                                       \
    VPORTDIS_RGBX_DISABLE,/* RGB extract disable */          \
    0,                    /* incPix, for raw mode only */    \
    (DISPLAY_PAL_LINE_SZ>>3),         /*thrld     */         \
    3,                    /*numFrmBufs*/                     \
    128,                    /*alignment */                   \
    VPORT_FLDS_MERGED,    /*mergeFlds */                     \
    NULL,                 /*segId     */                     \
    EDMA_OPT_PRI_HIGH,    /*edmaPri   */                     \
    8                     /* irqId    */                     \
}                                                           

#define EVMDM642_DIS_PARAMS_CHAN_BT656_DEFAULT(Mode)  \
  _EVMDM642_DIS_PARAMS_CHAN_##Mode##_DEFAULT
